<?php
require ('includes.php');
session_start();

$conn = mysql_connect(SERVER, USER, PASSWORD) or die("erreur de connexion");
mysql_select_db(DATABASE, $conn) or die("erreur de select db");
setlocale(LC_TIME, 'fr_FR.UTF-8', 'fra');
if (!isset($_GET['page']) || page_a_proteger($_GET['page'])){
    page_protect();
}

?>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>CATEL</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
            <script language="JavaScript" type="text/javascript" src="JS/jquery-1.8.2.min.js"></script>
            <script language="JavaScript" type="text/javascript" src="JS/jquery.validationEngine.js"></script>
            <script language="JavaScript" type="text/javascript" src="JS/jquery.validationEngine-fr.js"></script>
            <script language="JavaScript" type="text/javascript" src="JS/CATEL-fonctions.js"></script>            
            <script>
                $(document).ready(function(){
                    jQuery("#logForm").validationEngine();
                    jQuery("#form_info").validationEngine();
                    jQuery("#form_MDP").validationEngine();
                    jQuery("#form_journee").validationEngine();
                    jQuery("#form_confirm_commande").validationEngine();
                });  
            </script>
            <link href="styles/style.css" rel="stylesheet" type="text/css"/>
            <link href="styles/validationEngine.jquery.css" rel="stylesheet" type="text/css"/>
    </head>

    <body>
        <center>
            <div style="width:700px">
                <?php 
             
                if (isset($_SESSION['idUtilisateur'])) {?>
                
                 <div style="text-align: right"><h3>Bienvenue <?php echo  ucwords($_SESSION['prenomUtilisateur']).' '.strtoupper($_SESSION['nomUtilisateur']);?> - <a href="index.php?page=logout">D&eacute;connexion</a></h3></div>
                 <a href="index.php" class="barre_bouton" style="width:100px">Mon compte</a>
                 <a href="index.php?page=services" class="barre_bouton" style="width:100px"">Mes services</a>
                 <a href="index.php?page=informations" class="barre_bouton" style="width:130px">Mes informations</a>
                           
                 <?php
                 
                 if (isset($_SESSION['commandeEnCours'])){
                     $rqt_cmd_en_cours = "SELECT totalTTC FROM Commande WHERE idCommande=".$_SESSION['commandeEnCours'];
                     $res_cmd_en_cours = mysql_query($rqt_cmd_en_cours);
                     list($totalTTC)=  mysql_fetch_array($res_cmd_en_cours);
                 ?>
                    <a class="barre_bouton_vide" style="width:138px">&nbsp;</a>
                    <a href="index.php?page=service" class="barre_bouton" style="width:190px">Mon panier : <?php echo number_format($totalTTC, 2, ',', '');?> €
 </a>
                 <?php
                 }else{
                 ?>
                    <a class="barre_bouton_vide" style="width:330px">&nbsp;</a>
                 <?php
                 }
                 }else{
                     if (isset($_GET['page']) && $_GET['page']!='login'){?>
                 <div style="text-align: right"><a class="bouton1" href="index.php?page=login">Connexion</a></div>
                 
                <?php                
                     }
                }
                ?>
                 <br/>
                 <?php
                require ('pages/gestion-pages.php'); 
                ?>
                
            </div>
        </center>

    </body>
</html>